package com.itheima.service.impl;

import com.itheima.dao.BookDao;
import com.itheima.service.BookService;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

public class BookServiceImpl implements BookService, InitializingBean, DisposableBean {
    //    将对象中的通过new方式建立的对象删掉
    private BookDao bookDao;

    public void save() {
        System.out.println("book service save ....");
        bookDao.save();
    }

    //     创建对应的set方法
    public void setBookDao(BookDao bookDao) {
        System.out.println("set....");
        this.bookDao = bookDao;
    }

    public void destroy() throws Exception {
        System.out.println("service destroy....");
    }

    //      在属性设置之后被创建
    public void afterPropertiesSet() throws Exception {
        System.out.println("service init...");
    }
}
